package com.itheima.item.service.impl;

import com.itheima.api.client.CartClient;
import com.itheima.item.domain.po.Goods;
import com.itheima.item.mapper.GoodsMapper;
import com.itheima.item.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2025-08-15
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
    @Autowired
    private CartClient cartClient;

    @Override
    @GlobalTransactional
    public void deleteById(Integer id) {
        System.out.println("item接到id："+id);
        this.removeById( id);
        System.out.println("执行删除item数据库的");
        cartClient.delete(4);
    }
}
